public class ProtoTypePattern {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person p1 = new Person();
        Person p2 = (Person) p1.clone();
        System.out.println("p1.age = " + p2.age);
        System.out.println(p1.location == p2.location);
    }
}


class Person implements Cloneable {
    int age = 10;
    Location location = new Location();

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}

class Location {
    String location = "sss";
}
